/**
 * @see https://umijs.org/zh-CN/plugins/plugin-access
 * */
import {getGuidList} from "@/utils/localStoreUtil";

export default function access(initialState: { currentUser?: API.LoginUserData | undefined }) {
  const { currentUser } = initialState || {};

  const authIds = getGuidList() || [];

  return {
    Backend:(route:any) => currentUser && currentUser.loginType === 'Backend' && authIds.includes(route.guid),
    SysAdmin:(route:any)=> currentUser && currentUser.loginType === 'SysAdmin'&& authIds.includes(route.guid)
  };
}
